From: Andrew Zaborowski Date: Tue, 18 Sep 2018 03:47:43 +0000 (+0200) Subject: networkAgent: Ask for wifi secrets in the hints paremeter X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~929^2^2~23 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=4609cf191220e64dd4241fa4bca9f0df1bcb9b81;p=gnome-shell.git networkAgent: Ask for wifi secrets in the hints paremeter The `hints` and `settingName` parameters to the agent call may define the specific list of secrets NM actually needs from the user. This seems to have been the intended use of these two parameters but only recently did NM with the IWD backend start to use this to request 802.1x secrets. So if `hints` is provided, ask user for the specific secrets listed there and don't even look at what type of EAP method is in use. Only the three types of secrets actually in use by NM's IWD backend are supported for now -- they happen to be the same three that _get8021xSecrets() had already supported. --- diff --git a/js/ui/components/networkAgent.js b/js/ui/components/networkAgent.js index 998fcb792..6f7b81f94 100644 --- a/js/ui/components/networkAgent.js +++ b/js/ui/components/networkAgent.js @@ -198,6 +198,12 @@ var NetworkSecretDialog = new Lang.Class({ _getWirelessSecrets(secrets, wirelessSetting) { let wirelessSecuritySetting = this._connection.get_setting_wireless_security(); + + if (this._settingName == '802-1x') { + this._get8021xSecrets(secrets); + return; + } + switch (wirelessSecuritySetting.key_mgmt) { // First the easy ones case 'wpa-none': @@ -231,6 +237,20 @@ var NetworkSecretDialog = new Lang.Class({ let ieee8021xSetting = this._connection.get_setting_802_1x(); let phase2method; + /* If hints were given we know exactly what we need to ask */ + if (this._settingName == "802-1x" && this._hints.length) { + if (this._hints.includes('identity')) + secrets.push({ label: _("Username: "), key: 'identity', + value: ieee8021xSetting.identity || '', password: false }); + if (this._hints.includes('password')) + secrets.push({ label: _("Password: "), key: 'password', + value: ieee8021xSetting.password || '', password: true }); + if (this._hints.includes('private-key-password')) + secrets.push({ label: _("Private key password: "), key: 'private-key-password', + value: ieee8021xSetting.private_key_password || '', password: true }); + return; + } + switch (ieee8021xSetting.get_eap_method(0)) { case 'md5': case 'leap':